//
//  DXStatusViewModel.swift
//  新浪微博
//
//  Created by dix on 2017/2/6.
//  Copyright © 2017年 dix. All rights reserved.
//

import UIKit

class DXStatusViewModel: NSObject {
    var homeModel: DXHomeModel?{
        didSet{
            membershipImage = dealMembershipImage(mbrank: homeModel?.user?.mbrank ?? 0)
            avatarImage = dealAvatarImage(verified: homeModel?.user?.verified ?? -1)
        }
    }
    var membershipImage: UIImage?
    var avatarImage: UIImage?
}
//处理微博等级
extension DXStatusViewModel{
    //会员等级1-6
    func dealMembershipImage(mbrank: Int) -> UIImage? {
        if mbrank >= 1 && mbrank <= 6 {
            return UIImage(named: "common_icon_membership_level\(mbrank)")
        }else{
            return UIImage(named: "common_icon_membership")
        }
    }
    func dealAvatarImage(verified: Int) -> UIImage? {
        switch verified {
        case 1:
            return UIImage(named: "avatar_vip")
        case 2,3,5:
            return UIImage(named: "avatar_enterprise_vip")
        case 220:
            return UIImage(named: "avatar_grassroot")
        default:
            return UIImage(named: "avatar_vgirl")
        }
        
        
    }

}
